<?php
class HomeController extends AppController  {
	public $helpers = array('Html', 'Form');
	public $uses = array('Category', 'Subcategory');
	
	/**
     * Called before the controller action. 
     */
	public function beforeFilter() {
        parent::beforeFilter();
        $this -> Auth -> allow('*');
    }
	
	/**
	 *  Action load page default layout
	 */
	public function index() {
		$this -> layout = "layout_1";
		$this -> set('title_page', 'Hoàng Nhân');
		$this -> getDataMenu();
	}
	
	/**
	 *  Action load page default layout
	 */
	public function gioithieu() {
		$this -> layout = "layout_2";
		$this -> set('title_page', 'Hoàng Nhân');
	}
	
	private function getDataMenu() {
		$this -> getDataCategory();
	}
	
	private function getDataCategory() {
		$categoryList = $this -> Category -> find(
			'all',
			array(
				'conditions' => array(
    				'status' => 1
    			),
				'order' => array(
					'toporder' => 'ASC'
				)
			)
		);
		
		//echo "<pre>";
		//print_r($categoryList);
		//echo "</pre>";
		//die();
	}
	
	private function getDataSubCategory($idCategory) {
		
	}
}